package cn.edu.scau.cmi.wujiaxian.exercise9;

import java.util.Calendar;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class XiTi {
	
	@SuppressWarnings("resource")
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		//1:A,B,D
		//2:Love:Game
		//3:15 abc我们
		//4:13579
		//5:9javaHello
		//6:
		System.out.println("abcD".toUpperCase());
		System.out.println("abcD".toLowerCase());
		System.out.println("adbc".concat("e"));
		//7:
		System.out.println("abcd".charAt(0));
		System.out.println("abcd".charAt("abcd".length() - 1));
		//8:
		new CalendaBean().rili(scanner.nextInt(), scanner.nextInt());
		//9:
		Calendar calendar = Calendar.getInstance();
		calendar.set(2018, 11, 18);
		long time1 = calendar.getTimeInMillis();
		calendar.set(2017, 11, 18);
		long time2 = calendar.getTimeInMillis();
		System.out.println();
		System.out.println((time1 - time2) / (1000 * 60 * 60 * 24 ));
		//10:
		System.out.println(Math.sqrt(5));
		//11:
		Pattern pattern = Pattern.compile("[\\d]+");
		Matcher matcher = pattern.matcher("ab123you");
		while (matcher.find()) {
			System.out.println(matcher.group());
		}
		//12:
		Scanner scanner2 = new Scanner("数学87分，物理76分，英语96分");
		scanner2.useDelimiter("[^\\d]+");
		double sum = 0;
		while (scanner2.hasNext()) {
			sum += scanner2.nextInt();
		}
		System.out.println(sum);
		System.out.println(sum / 3);
	} 

}
